<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

global $data, $admin;

class Xpanel extends CI_Controller {

    public function __construct() {
        parent::__construct();
        global $admin, $data;
        # cargamos variables
        $admin = $this->session->userdata('admin');
        $admin['place'] = 'xpanel';
        # verifica si pasó por home
        if ($admin['ta_tipo_administrador_id'] != 1) {
            redirect('home');
        }
        $this->output->enable_profiler(FALSE);
    }

    public function index() {
        global $data, $admin;
        #Variables de promedios
        $data['empresa_cal'] = $this->cc_model_a->promXE();
        $data['division_cal'] = $this->cc_model_a->promXD();
        $data['tpersonasXE'] = $this->cc_model_a->tpersonasXE();
        $data['graphComp'] = $this->cc_model_b->dataGraphCom();
        $this->load->view('template/header', $admin);
        $this->load->view('template/open_content_container');
        $this->load->view('menu/menu_admin', $data);
        $this->load->view('panel/cpanel_main');
        $this->load->view('template/close_content_container');
        $this->load->view('template/footer');
    }

    public function logOut() {
        //termina session de ususario
        $this->session->sess_destroy();
        redirect(base_url());
    }

}
